# 导入flask
from flask import Flask,request

app = Flask(__name__)

@app.route("/")
def hello_world():
    # return "Hello, World!"
    return "你好世界，flask111222"

@app.route("/hello")
def hello():
    return "你访问了hello的get接口"

@app.route("/hello/w")
def hello2():
    return "你访问了hello路径下的w的get接口"


# 第一种 格式为 ?key1=value1&key2=value2&key3=value3 。。。。。。
@app.route("/param")
def param():
    # ie=utf-8
    ie = request.args.get("ie")
    f = request.args.get("f")
    name = request.args.get("teacher")
    return ie + f + name

# 第二种  /参数1/参数2
@app.route("/param2/<username>/<password>")
def param2(username,password):
    print(username)
    print(password)
    return username + password

@app.route("/param3/<username>")
def param3(username):
    id = request.args.get("id")
    return username + id

if __name__ == '__main__':
    # 这里要加一行flask的启动代码
    app.run()
    # app.run(debug=True)

